package screenIntroduction;
import java.awt.DisplayMode;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Window;

import javax.swing.JFrame;


public class Screen {
    
    private GraphicsDevice vc;	//video card
    
    public Screen() {
	GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
	vc = env.getDefaultScreenDevice();
    }
    
    public void setFullScreen(DisplayMode dm, JFrame window) {
	window.setUndecorated(true);	//no titlebars or scrollbars
	window.setResizable(false);
	vc.setFullScreenWindow(window);
	if(dm != null && vc.isDisplayChangeSupported()) {
	    vc.setDisplayMode(dm);
	}
    }
    
    public Window getFullScreenWindow() {
	return vc.getFullScreenWindow();
    }
    
    public void restoreScreen() {
	Window w = vc.getFullScreenWindow();
	if (w != null) {
	    w.dispose();
	}
	vc.setFullScreenWindow(null);
    }
    
}
